{if $vo}
<form class="layui-form layui-box" style='padding:25px 30px 20px 0' action='{:url("$classuri/action_edit")}' data-auto="true" method="post">
    
    <div class="layui-form-item">
        <label class="layui-form-label label-required">会员名称</label>
        <div class="layui-input-block">
            <input readonly="readonly" disabled="disabled" name="uname" value='{$vo.uname|default=""}' required="required" title="请输入会员名称" placeholder="请输入会员名称" class="layui-input layui-disabled">
        </div>
    </div>

    <div class="layui-form-item layui-block">
        <label class="layui-form-label">头像</label>
        <div style="position:relative">
            <div class="uploadimage" style="background-image: url('__SRC__{$vo.head_portrait}');" data-tips-image="__SRC__{$vo.head_portrait}">
                <input type="hidden" name="head_portrait">
            </div>
            <a data-file="one" data-field="head_portrait" data-type="png,jpg" data-uptype="local" href="javascript:void(0)" class="uploadbutton">上传图片</a>
        </div>
    </div>

    <div class="layui-form-item layui-block">
        <label class="layui-form-label">昵称</label>
        <div class="layui-input-block">
            <input type="text" name="nickname" value="{$vo.nickname|default=''}" placeholder="请输入会员昵称" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-block">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <label class="think-radio">
                <input {eq name="$vo.sex|default=''" value="1"} checked {/eq} type="radio" name="sex" value="1" title="男" style="display: inline-block;"> 男
            </label>
            <label class="think-radio">
                <input {eq name="$vo.sex|default=''" value="2"} checked {/eq} type="radio" name="sex" value="2" title="女" style="display: inline-block;"> 女
            </label>
        </div>
    </div>

    <div class="hr-line-dashed"></div>

    <div class="layui-form-item text-center">
        {if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'/>{/if}
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>
</form>
<script type="text/javascript">
    // 监听 input 的 onchange 事件
    // 当有文件上传时，会触发 change 事件
    require(['jquery'], function () {
        $('[name="head_portrait"]').on('change', function () {
            $(this).parent().attr('data-tips-image', this.value).css('backgroundImage', 'url(' + this.value + ')');
        });
    });
    
</script>
{else}
<form class="layui-form layui-box" style='padding:25px 30px 20px 0' action='{:url("$classuri/action_add")}' data-auto="true" method="post">
    
    <div class="layui-form-item">
        <label class="layui-form-label label-required">会员名称</label>
        <div class="layui-input-block">
            <input id="uname" name="uname" value='{$vo.uname|default=""}' required="required" pattern="^.{4,}$" title="请输入会员名称" placeholder="请输入4位及以上字符会员名称" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label label-required">设置密码</label>
        <div class="layui-input-block">
                <input name="password" value='{$vo.password|default=""}' required="required" pattern="^\S{1,}$" required="" title="请输入设置密码" placeholder="请输入设置密码" class="layui-input">
        </div>
    </div>
  
    <div class="hr-line-dashed"></div>

    <div class="layui-form-item text-center">
        {if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'/>{/if}
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>
</form>
{/if}
